package ${package}.${bottomName}.${entityName};
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.*;
import lombok.*;
<#if hasDate?? && hasDate>
import java.util.Date;
import java.time.Instant;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
</#if>
<#if hasInstant?? && hasInstant>
import java.time.Instant;
</#if>
<#if hasBigDecimal?? && hasBigDecimal>
import java.math.BigDecimal;
</#if>
<#if hasBaseColumns?? &&hasBaseColumns>
import com.rainbow.support.mybatis.entity.BaseEntity;
</#if>

/**
* ${comments}
* @author ${author}
* 邮箱  ${email}
* @date ${datetime}
*/
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("${tableName}")
@ApiModel(value = "${comments}实体类")
<#if hasBaseColumns?? &&hasBaseColumns>
public class ${className}Entity extends BaseEntity {

	<#if diffColumns?? &&diffColumns?size gt 0>
		<#list diffColumns as column>
		/**
		* ${column.comments}
		*/
		    <#if column.nullAble?? && column.nullAble=='true'>
		@ApiModelProperty(value = "${column.comments}",required = true)
			<#else>
		@ApiModelProperty(value = "${column.comments}")
		<#if operatorStrategy?? && operatorStrategy!='DEFAULT'>
		@TableField(insertStrategy = FieldStrategy.${operatorStrategy},updateStrategy = FieldStrategy.${operatorStrategy})
		</#if>
			</#if>
			<#if column.attrType?? && column.attrType=='Date'>
		@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
		@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
			</#if>
			<#if column.defaultValue?? && column.defaultValue!=null >
				<#if column.attrType?? && column.attrType=='String'>
		private ${column.attrType} ${column.attrname} ="${column.defaultValue}";
				<#elseif column.attrType?? && column.attrType=='Date' && column.defaultValue=='CURRENT_TIMESTAMP'>
		private ${column.attrType} ${column.attrname} =new Date();
				<#elseif column.attrType?? && column.attrType=='Instant' && column.defaultValue=='CURRENT_TIMESTAMP'>
		private ${column.attrType} ${column.attrname} =Instant.now();
				<#elseif column.attrType?? && column.attrType=='BigDecimal' && column.defaultValue!=null>
		private ${column.attrType} ${column.attrname} =new BigDecimal(${column.defaultValue});
				<#else>
		private ${column.attrType} ${column.attrname} =${column.defaultValue};
				</#if>
			<#else>
		private ${column.attrType} ${column.attrname};
			</#if>
		</#list>
	</#if>

<#else>
public class ${className}Entity implements Serializable {

		private static final long serialVersionUID = 1L;
	<#if columns?? &&columns?size gt 0>
		<#list columns as column>
		/**
		* ${column.comments}
		*/
			<#if column.nullAble?? && column.nullAble=='true'>
		@ApiModelProperty(value = "${column.comments}",required = true)
			<#else>
		@ApiModelProperty(value = "${column.comments}")
		<#if operatorStrategy?? && operatorStrategy!='DEFAULT'>
		@TableField(insertStrategy = FieldStrategy.${operatorStrategy},updateStrategy = FieldStrategy.${operatorStrategy})
		</#if>
			</#if>
			<#if column.attrType?? && column.attrType=='Date'>
		@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
		@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
			</#if>
			<#if column.defaultValue?? && column.defaultValue!=null >
				<#if column.attrType?? && column.attrType=='String'>
		private ${column.attrType} ${column.attrname} ="${column.defaultValue}";
				<#elseif column.attrType?? && column.attrType=='Date' && column.defaultValue=='CURRENT_TIMESTAMP'>
		private ${column.attrType} ${column.attrname} =new Date();
				<#elseif column.attrType?? && column.attrType=='Instant' && column.defaultValue=='CURRENT_TIMESTAMP'>
		private ${column.attrType} ${column.attrname} =Instant.now();
				<#elseif column.attrType?? && column.attrType=='BigDecimal' && column.defaultValue!=null>
		private ${column.attrType} ${column.attrname} =new BigDecimal(${column.defaultValue});
				<#else>
		private ${column.attrType} ${column.attrname} =${column.defaultValue};
				</#if>
			<#else>
		private ${column.attrType} ${column.attrname};
			</#if>
		</#list>
	</#if>

</#if>



}
